jvm
fuzion.jvm
an effect that allows calling java code from fuzion
Functions
abortable => bool[Inherited from effect]¶[src]
does this effect support abort?
Helps detecting unexpected calls to
`abort` at runtime and ensure that the static analysis finds that the
code executed with this effect will always return normally and produce
a result. This is used, e.g, in `mutate` to avoid static analysis
reporting `panic` as an effect of the use of a local mutate instance.
Helps detecting unexpected calls to
`abort` at runtime and ensure that the static analysis finds that the
code executed with this effect will always return normally and produce
a result. This is used, e.g, in `mutate` to avoid static analysis
reporting `panic` as an effect of the use of a local mutate instance.
and(R:Any,E:effect,e Lazy E) => Functional R[Inherited from effect]¶[src]
fluent interface for using multiple effects together
array_to_java_object(T:Any,a Sequence T) => fuzion.java.Array T¶[src]
convert a Sequence to a Java Array object
This only works for types that map to java primitives
If you want to create an array of complex types use `Java.as_java_object [...]`
This only works for types that map to java primitives
If you want to create an array of complex types use `Java.as_java_object [...]`
as_functional(R:Any) => Functional R[Inherited from effect]¶[src]
this effect reinterpreted as a Functional
which allows composition of effects
which allows composition of effects
as_string => String[Inherited from Any]¶[src]
create a String from this instance. Unless redefined, `a.as_string` will
create `"instance[T]"` where `T` is the dynamic type of `a`
create `"instance[T]"` where `T` is the dynamic type of `a`
bool_to_java_object(b bool) => fuzion.java.Java_Object¶[src]
intrinsic to convert a bool to a Java Boolean object
call_constructor(T:Any,class_name String,signature String,args array fuzion.java.Java_Object) => outcome T¶[src]
Call a Java constructor with given signature for class with given name
with given arguments
with given arguments
call_static(T:Any,class_name String,name String,signature String,args array fuzion.java.Java_Object) => outcome T¶[src]
Call a static Java method with given name and signature with given
arguments
arguments
call_virtual(T:Any,class_name String,name String,signature String,thiz fuzion.java.Java_Object,args array fuzion.java.Java_Object) => outcome T¶[src]
Call a virtual Java method class_name.name with given signature signature
on instance thiz with given arguments
on instance thiz with given arguments
cast(T:fuzion.java.Java_Object,thiz fuzion.java.Java_Object) => outcome T¶[src]
cast this to some other class
dynamic_apply(R:Any,F:Typed_Function R,f F) => R[Inherited from Any]¶[src]
dynamic_apply -- apply `f.call` to `Any.this`'s dynamic type and value
This can be used to perform operation on values depending on their dynamic
type.
Here is an example that takes a `Sequence Any` that may contain boxed values
of types `i32` and `f64`. We can now write a feature `get_f64` that extracts
these values converted to `f64` and build a function `sum` that sums them up
as follows:
This can be used to perform operation on values depending on their dynamic
type.
Here is an example that takes a `Sequence Any` that may contain boxed values
of types `i32` and `f64`. We can now write a feature `get_f64` that extracts
these values converted to `f64` and build a function `sum` that sums them up
as follows:
dynamic_type => Type[Inherited from Any]¶[src]
Get the dynamic type of this instance. For value instances `x`, this is
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
f32_to_java_object(v f32) => fuzion.java.Java_Object¶[src]
intrinsic to convert an f32 to a Java Float object
f64_to_java_object(v f64) => fuzion.java.Java_Object¶[src]
intrinsic to convert a f64 to a Java Double object
finally => unit[Redefinition of effect.finally]¶[src]
cleanup the started jvm
get_field(T:Any,thiz fuzion.java.Java_Object,field String,signature String) => T¶[src]
read a field of given name from given object instance thiz. Wrap result into
an instance of T.
an instance of T.
get_static_field(T:Any,clazz String,field String,signature String) => T¶[src]
read a static field of given name in class with given name. Wrap result into
an instance of T.
an instance of T.
i16_to_java_object(v i16) => fuzion.java.Java_Object¶[src]
intrinsic to convert an i16 to a Java Short object
i32_to_java_object(v i32) => fuzion.java.Java_Object¶[src]
intrinsic to convert an i32 to a Java Integer object
i64_to_java_object(v i64) => fuzion.java.Java_Object¶[src]
intrinsic to convert an i64 to a Java Long object
i8_to_java_object(v i8) => fuzion.java.Java_Object¶[src]
intrinsic to convert an i8 to a Java Byte object
infix !(R:Any,code Function R) => R[Inherited from effect]¶[src]
infix variant instate_self
use it like this:
use it like this:
instate_self(R:Any,code Function R) => R[Inherited from effect]¶[src]
convenience version of `instate` for effect values whose type is
exactly the effect type (i.e., the value type does not inherit
from the effect type).
Execute 'code' in a context where this effect instance has been
instated for effect type `effect.this`.
In case `f` returns normally, this will return `f`'s result.
In case `f` aborts this effect, this will panic.
exactly the effect type (i.e., the value type does not inherit
from the effect type).
Execute 'code' in a context where this effect instance has been
instated for effect type `effect.this`.
In case `f` returns normally, this will return `f`'s result.
In case `f` aborts this effect, this will panic.
null(T:fuzion.java.Java_Object) => outcome T¶[src]
get a null value of type T
prefix $ => String[Inherited from Any]¶[src]
convenience prefix operator to create a string from a value.
This permits usage of `$` as a prefix operator in a similar way both
inside and outside of constant strings: $x and "$x" will produce the
same string.
This permits usage of `$` as a prefix operator in a similar way both
inside and outside of constant strings: $x and "$x" will produce the
same string.
replace => unit[Inherited from effect]¶[src]
replace existing effect of type `effect.this` by the new effect value `effect.this`.
This is a convenience feature for value type effects for which the type of
the effect instance equals the effect type. `ref` type effects typically have
values that may be children of the effect type that are of a different type, so
`effect_type.replace new_value` must be used.
replace may only be called during the execution of an operation of a currently instated
effect of the same effect type.
This is a convenience feature for value type effects for which the type of
the effect instance equals the effect type. `ref` type effects typically have
values that may be children of the effect type that are of a different type, so
`effect_type.replace new_value` must be used.
replace may only be called during the execution of an operation of a currently instated
effect of the same effect type.
set_field(thiz fuzion.java.Java_Object,field String,val fuzion.java.Java_Object,signature String) => unit¶[src]
set a field of given name from given object instance thiz.
set_static_field(clazz String,field String,val fuzion.java.Java_Object,signature String) => unit¶[src]
set a static field of given name in class with given name.
string_to_java_object(s String) => fuzion.java.Java_Object¶[src]
convert a string to a Java String object
u16_to_java_object(v u16) => fuzion.java.Java_Object¶[src]
intrinsic to convert an u16 to a Java Character object
Type Features
type.abort => void[Inherited from effect]¶[src]
Abort code execution for the instated effect.this.env and return to the point
where the effect was instated.
where the effect was instated.
type.abort(e effect.this) => void[Inherited from effect]¶[src]
replace existing effect for type `effect.this` by the new effect value `e`
and abort code execution to return to the point where the effect was instated.
and abort code execution to return to the point where the effect was instated.
type.as_string => String[Inherited from Type]¶[src]
string representation of this type to be used for debugging.
result has the form "<name>", but this might change in the future
result has the form "<name>", but this might change in the future
type.default_value => option effect.this[Inherited from effect]¶[src]
If this effect may be instated automatically at application start (during the
effect big bang singularity), this should be redefined to return the
corresponding effect value
effect big bang singularity), this should be redefined to return the
corresponding effect value
type.dynamic_type => Type[Inherited from Type]¶[src]
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types, so dynamic_type is redefined to just return
Type.type here.
Note: Typechecking is undecidable when 'type' is a type, Mark B. Reinhold, 1989
see: https://dspace.mit.edu/bitstream/handle/1721.1/149366/MIT-LCS-TR-458.pdf?sequence=6
endless hierarchy of types, so dynamic_type is redefined to just return
Type.type here.
Note: Typechecking is undecidable when 'type' is a type, Mark B. Reinhold, 1989
see: https://dspace.mit.edu/bitstream/handle/1721.1/149366/MIT-LCS-TR-458.pdf?sequence=6
type.from_env => effect.this[Inherited from effect]¶[src]
get this effect from env
type.get_if_instated => option effect.this[Inherited from effect]¶[src]
has an effect of the given type been instated?
type.infix :(T:Any) => bool[Inherited from Type]¶[src]
Is this type assignable to a type parameter with constraint `T`?
The result of this is a compile-time constant that can be used to specialize
code for a particular type.
it is most useful in conjunction with preconditions or `if` statements as in
or
The result of this is a compile-time constant that can be used to specialize
code for a particular type.
it is most useful in conjunction with preconditions or `if` statements as in
or
type.instate(R:Any,e effect.this,code Function R) => R[Inherited from effect]¶[src]
execute 'code' in a context where the effect instance `e` has been
installed for effect type `effect.this`.
In case effect.this is aborted anywhere in the code
this will result in a compile time failure.
installed for effect type `effect.this`.
In case effect.this is aborted anywhere in the code
this will result in a compile time failure.
type.instate(R:Any,e effect.this,code Function R,def Unary R effect.this) => R[Inherited from effect]¶[src]
execute 'code' in a context where the effect instance `e` has been
installed for effect type `effect.this`.
In case `f` returns normally, this will return `f`'s result.
In case `f` aborts this effect, return `def()`.
installed for effect type `effect.this`.
In case `f` returns normally, this will return `f`'s result.
In case `f` aborts this effect, return `def()`.
type.is_instated => bool[Inherited from effect]¶[src]
has an effect of this type been instated?
type.name => String[Inherited from Type]¶[src]
name of this type, including type parameters, e.g. 'option (list i32)'.
type.prefix $ => String[Inherited from Type]¶[src]
convenience prefix operator to create a string from a value.
This permits usage of `$` as a prefix operator in a similar way both
inside and outside of constant strings: $x and "$x" will produce the
same string.
NYI: Redefinition allows the type feature to be distinguished from its normal counterpart, see #3913
This permits usage of `$` as a prefix operator in a similar way both
inside and outside of constant strings: $x and "$x" will produce the
same string.
NYI: Redefinition allows the type feature to be distinguished from its normal counterpart, see #3913
type.replace(e effect.this) => unit[Inherited from effect]¶[src]
replace existing effect for type `effect.this` by the new effect value `e`.
For effects that model the outside world (e.g., i/o, time, sensors and actuators, etc.),
the effect might be a unit type, so the replace is effectively a no-operation. However,
the call to `replace` is used to model the change of the outside world and must be
included for analysis tools to appreciate this.
replace may only be called during the execution of an operation of a currently instated
effect of the same effect type.
NYI: BUG: It is currently not enforced that replace is only called during the execution
of an operation of a currently instated effect of the same effect type.
For effects that model the outside world (e.g., i/o, time, sensors and actuators, etc.),
the effect might be a unit type, so the replace is effectively a no-operation. However,
the call to `replace` is used to model the change of the outside world and must be
included for analysis tools to appreciate this.
replace may only be called during the execution of an operation of a currently instated
effect of the same effect type.
NYI: BUG: It is currently not enforced that replace is only called during the execution
of an operation of a currently instated effect of the same effect type.
type.type_value => Type[Inherited from Any]¶[src]
Get a type as a value.
This is a feature with the effect equivalent to Fuzion's `expr.type` call tail.
It is recommended to use `expr.type` and not `expr.type_value`.
`type_value` is here to show how this can be implemented and to illustrate the
difference to `dynamic_type`.
This is a feature with the effect equivalent to Fuzion's `expr.type` call tail.
It is recommended to use `expr.type` and not `expr.type_value`.
`type_value` is here to show how this can be implemented and to illustrate the
difference to `dynamic_type`.
type.use(T:Any,code Function T) => T¶[src]
shorthand to for jvm with no additional class path
type.use(T:Any,option_strings array String,code Function T) => T¶[src]
- start jvm (or use an existing jvm)
- instate effect `fuzion.jvm`
- run code on the jvm
- destroy jvm (if jvm had to be started)
- instate effect `fuzion.jvm`
- run code on the jvm
- destroy jvm (if jvm had to be started)
0.099dev (GIT hash e2d5298d8107bb5fe79600fdb06a49bc75756344)